//------------------------------------------------------------------------------
// The contents of this file are subject to the nopCommerce Public License Version 1.0 ("License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at  http://www.nopCommerce.com/License.aspx. 
// 
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
// See the License for the specific language governing rights and limitations under the License.
// 
// The Original Code is nopCommerce.
// The Initial Developer of the Original Code is NopSolutions.
// All Rights Reserved.
// 
// Contributor(s): _______. 
//------------------------------------------------------------------------------

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Tathata.Common.BLL.Entities;
using Tathata.Common.BLL.Managers;
using System.Text;
using Tathata.Common.Utils;
using Tathata.Common.BLL.EntityCollections;
using System.ComponentModel;
using Tathata.Common;

namespace Tathata.Web.Modules.Account
{
    public partial class CustomerLoginControl : BaseNopUserControl
    {
        private void ApplyLocalization()
        {
            btnRegister.Text = GetLocaleResourceString("Common.Register");
            Literal lEMailAddress = LoginForm.FindControl("lEMailAddress") as Literal;
            if (lEMailAddress != null)
                lEMailAddress.Text = GetLocaleResourceString("LoginPage.E-MailAddress");
            Literal lPassword = LoginForm.FindControl("lPassword") as Literal;
            if (lPassword != null)
                lPassword.Text = GetLocaleResourceString("LoginPage.Password");
            CheckBox cbRememberMe = LoginForm.FindControl("RememberMe") as CheckBox;
            if (cbRememberMe != null)
                cbRememberMe.Text = GetLocaleResourceString("LoginPage.RememberMe");
            Button btnLogin = LoginForm.FindControl("LoginButton") as Button;
            if (btnLogin != null)
                btnLogin.Text = GetLocaleResourceString("LoginPage.LoginButton");

            LoginForm.FailureText = GetLocaleResourceString("LoginPage.FailureText");
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires = 0;
            Response.AddHeader("pragma", "no-cache");

            this.ApplyLocalization();
        }

        protected void OnLoggedIn(object sender, EventArgs e)
        {
            //string str = string.Empty;
            //str = Page.Request.QueryString["ReturnUrl"];
            //if (string.IsNullOrEmpty(str))
            //    str = "~/Default.aspx";

            //this.LoginForm.DestinationPageUrl = str;
        }

        protected void btnRegister_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Register.aspx");
        }
    }
}